package priv.tuyou.redis.simple;

import java.util.HashSet;
import java.util.Set;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

/**
 * Hello world!
 *
 */
public class ClusterTest
{
    public static void main( String[] args )
    {
    	Set<HostAndPort> jedisClusterNodes = new HashSet<>();
        jedisClusterNodes.add(new HostAndPort("localhost", 9349));
        jedisClusterNodes.add(new HostAndPort("localhost", 9359));
        jedisClusterNodes.add(new HostAndPort("localhost", 9369));
        jedisClusterNodes.add(new HostAndPort("localhost", 9379));
        jedisClusterNodes.add(new HostAndPort("localhost", 9389));
        jedisClusterNodes.add(new HostAndPort("localhost", 9399));
		JedisCluster jedisCluster = new JedisCluster(jedisClusterNodes);
        long start = System.currentTimeMillis();
        jedisCluster.set("name", "tuyou");
        long end = System.currentTimeMillis();
        System.out.println((end-start)/1000.0);
        System.out.println(jedisCluster.get("name"));
    }
}
